#include "VertexArray.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>

VertexArray::VertexArray()
{
	glGenVertexArrays(1, &m_Vao);
	glBindVertexArray(m_Vao);
}

VertexArray::~VertexArray()
{
	glBindVertexArray(0);
	glDeleteVertexArrays(1, &m_Vao);
}

void VertexArray::Bind()
{
	glBindVertexArray(m_Vao);
}

void VertexArray::Unbind()
{
	glBindVertexArray(0);
}

void VertexArray::SetVertexAttribute(unsigned int idx, unsigned int vertexNum, int type, int isNormalize, unsigned int stripe, unsigned int offset)
{
	glVertexAttribPointer(idx, vertexNum, type, isNormalize, stripe, (void*)offset);
	glEnableVertexAttribArray(idx);
}